package com.keycloak.admin.utils;

import com.keycloak.admin.client.KeycloakAdminClient;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class KeycloakClientManager {

    private static Map<String,KeycloakAdminClient>  clientMap = new ConcurrentHashMap<>();

    public static  KeycloakAdminClient getClientMap(String clientId) {
        if(clientMap == null )  clientMap = new ConcurrentHashMap<>();
        if (clientMap.get(clientId) == null) return null;
        return clientMap.get(clientId);
    }

    public static void setClientMap(String clientId,KeycloakAdminClient keycloakAdminClient) {
        clientMap.put(clientId,keycloakAdminClient);
    }

    public static void clearMap(){
        clientMap.clear();
    }
}
